﻿#ifndef MYMAINROLE_H
#define MYMAINROLE_H

#include <QObject>
#include "mystudio.h"
#include <QDrag>
#include <QMimeData>
#include <QGraphicsSceneMouseEvent>

#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonObject>

class MyMainRole :public QObject, public QGraphicsPixmapItem
{
    Q_OBJECT
public:
    MyMainRole(qreal mustWidth,int state);
    ~MyMainRole() override;
    void setPoint(int x,int y);
    QPoint getPoint();
    QJsonObject toJson();
    int getState();

private:
    qreal mWidth;
    void setState(int state);
    QList<QPixmap> list;
    int mState = 0;

    //在阵列中的排序
    QPoint mPoint;

protected:
    void mousePressEvent(QGraphicsSceneMouseEvent *event) override;

signals:
    //当要移动时命令垃圾桶显示
    void sendGarbageDisplay(bool display);


};

extern MyMainRole *moveRole;

#endif // MYMAINROLE_H
